package com.example.property;

public class DwellingBuildingPropertyForm {
    public String client;
    public double insuredValue;
    public double rate;
    public int yearsOfInsurance;

    public DwellingBuildingPropertyForm(String client,
                                        double insuredValue, double rate, int yearsOfInsurance){
        this.client = client;
        this.insuredValue = insuredValue;
        this.rate = rate;
        this.yearsOfInsurance = yearsOfInsurance;
    }

    public String printPolicy() {

        StringBuilder output = new StringBuilder();
        double expenses = insuredValue * rate * yearsOfInsurance;

        // print headers
        output.append("======Printing Policy======\n");
        output.append("Product: ").append("Dwelling Building Property Form").append('\n');
        output.append("Client: ").append(client).append('\n');
        output.append("Insured Value: ").append(insuredValue).append('\n');
        output.append("Rate: ").append(rate).append('\n');
        output.append("Years Of Insurance: ").append(yearsOfInsurance).append('\n');
        output.append("Expenses: ").append(expenses).append('\n');
        output.append("======Printing End=========\n");

        return output.toString();
    }
}
